<template>
	<view>
		<view style="display: flex;justify-content: space-around;height: 100upx;line-height: 100upx;background-color: #fff;">
			<view v-for="(item,index) in menus" :key='index' :class="{active: currentIndex === index}" @click="menusClick(index)">
				{{item}}
			</view>
		</view>
		<!-- 一级展开行 -->
		<view v-for="(item,index) in res" :key="index" style="background-color: #fff;margin-top: 20upx;line-height: 100upx;">
			<view style="display: flex;height: 110upx;">
				<!-- <view style="flex: 1;">
					<image style="width: 95upx;height: 90upx;margin:10upx 0upx 10upx 20upx;border-radius: 50upx;" :src="item.avatar" mode=""></image>
				</view> -->
				<view style="line-height: 50upx;flex: 2;margin-left: 30upx;">
					<view style="font-weight: bold;">{{item.nickname}}</view>
					<view style="color: #cdcdcd;font-size: 24upx;">{{item.time}}</view>
				</view>
				<view style="color: #7D7D7D;flex: 1.5;">
					<text>团队人数:</text><text style="font-weight: bold;color: #000000;">{{item.x_num}}</text>
				</view>
				<view style="color: #7D7D7D;flex: 1.5;">
					<text>业绩:</text><text style="font-weight: bold;color: #000000;">{{item.ping}}</text>
				</view>
				<!-- <switch style="flex: 1;" color="#000" :data-id="item.id" @change="switchChange" /> -->
			</view>
			
		</view>
		<view v-if="res.length == 0" style="padding-top: 300upx;">
			<image src="../../../static/searchlist.png" mode="" style="display: block;margin: 0 auto;width: 240upx;height: 240upx;"></image>
			<view style="text-align: center;color: #999;">暂时没有任何记录</view>
		</view>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				res: [],
				// res2: [],
				// res3:[],
				// res4:[],
				openid:'',
				real_name:'',
				real_head_img:'',
				create_time:'',
				check: false,
				menus:['会员中心','业务主任','销售经理','营销总监'],
				currentIndex:0,
				level:0,
			}
		},
		onLoad: function(e) {
			 this.openid = e.opid
			 this.setajax()
			},
		methods: {
			setajax(){
				var data = {
					openid: this.openid,
					level: this.level,
				}
				uni.request({
					url: 'http://mall.sytesco.com/app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=member.mycommunity.get_twouser&app=1',
					data: data,
					method:'POST',
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						console.log(res)
						this.res = res.data.user_list
					},
					fail: () => {},
					complete: () => {}
				});
			},
			menusClick(index){
				this.currentIndex = index
				this.level = this.currentIndex
				this.setajax()
			}
		}
	}
</script>

<style>
.active {border-bottom: 5upx solid #2B89F8}
</style>
